package debugx

import (
	"context"
	"fmt"
	"github.com/zeromicro/go-zero/core/logx"
	"runtime"
)

func PrintStack() {
	// 获取当前的堆栈信息
	buf := make([]byte, 2048)
	n := runtime.Stack(buf, false)
	stackTrace := string(buf[:n])
	fmt.Println("stackTrace1", stackTrace)

	ctx := context.Background()
	logx.WithContext(ctx).Errorf("stackTrace2: %v", stackTrace)
}
